QT       -= gui
QT       += core network

DEPLOY_DIR = $${OUT_PWD}/../deploy
DEPLOY_INCLUDE_DIR = $$DEPLOY_DIR/include
DEPLOY_LIB_DIR = $$DEPLOY_DIR/lib

TEMPLATE = lib
TARGET = protoqtrpc
DESTDIR = $$DEPLOY_LIB_DIR
DEPENDPATH += . src
INCLUDEPATH += $${OUT_PWD}

CONFIG(android) {
    CONFIG += plugin
}

# Input
HEADERS += \
    src/RpcController.h \
    src/RpcServer.h \
    src/RpcServerSession.h \
    src/BlockingClosure.h \
    src/SocketRpcChannel.h \
    src/SocketRpcServer.h \
    src/SocketRpcServerSession.h \
    src/DoneClosureRunner.h \
    src/SocketRpcProtocol.h

SOURCES += \
    src/RpcController.cpp \
    src/RpcServerSession.cpp \
    src/SocketRpcServer.cpp \
    src/SocketRpcServerSession.cpp \
    src/BlockingClosure.cpp \
    src/SocketRpcChannel.cpp \
    src/SocketRpcProtocol.cpp

PROTODIR = proto
PROTOSUBDIR = protoqtrpc
PROTOS = \
    $$PROTODIR/$$PROTOSUBDIR/rpcmessage.proto \
    $$PROTODIR/$$PROTOSUBDIR/options.proto

include ($${PWD}/../protobuf-compile.pri)

OTHER_FILES += $$PROTOS

QMAKE_POST_LINK += \
  mkdir -p $$DEPLOY_INCLUDE_DIR/protoqtrpc; \
  (cd $$PWD && $${QMAKE_COPY} \
        $$HEADERS $$PROTODIR/protoqtrpc/options.proto \
        $$OUT_PWD/protoqtrpc/options.pb.h \
        $$DEPLOY_INCLUDE_DIR/protoqtrpc/);
